package threads;

public class ThreadTest {
    public static void main(String[] args) throws Exception {
//        RunnableDemo r1 = new RunnableDemo("Thread-1");
//        r1.start();
//
//        RunnableDemo r2 = new RunnableDemo("Thread-2");
//        r2.start();

//        ThreadDemo t1 = new ThreadDemo("Thread-1");
//        t1.start();
//        ThreadDemo t2 = new ThreadDemo("Thread-2");
//        t2.start();

//        Object a = new Object();
//        Object b = new Object();
//        Object c = new Object();
//
//        ThreadPrint printA = new ThreadPrint("A", c, a);
//        ThreadPrint printB = new ThreadPrint("B", a, b);
//        ThreadPrint printC = new ThreadPrint("C", b, c);
//
//        new Thread(printA).start();
//        Thread.sleep(100);
//        new Thread(printB).start();
//        Thread.sleep(100);
//        new Thread(printC).start();
//        Thread.sleep(100);

        VolatileClass vc = new VolatileClass();

        new Thread(new Runnable() {
            @Override
            public void run() {
                vc.changeNumber();
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                vc.changeNumber();
            }
        }).start();
    }
}

